function searchInsert(nums: number[], target: number): number {
    let sub = nums.indexOf(target)
    if( sub !== -1){
        return sub
    }
    let i:number = 0;
    for(  i = 0 ; i < nums.length;i++ ){
        if(nums[i] > target){
            sub =  i;
            break;
        }
    }
    if( i === nums.length ){
        sub = nums.length;
    }
    return sub;
};
// let nums = [1,3,5,6], target = 5;
// let  nums = [1,3,5,6], target = 2;
let nums = [1,3,5,6], target = 7;
console.log(searchInsert(nums,target));